function find(event){
    let click=event.target;
    let elementId=click.id;
    console.log(elementId);
    var inputValue = document.getElementById('message').value;
    let container=document.getElementById('conta');
    let count=document.getElementById('count');
    container.textContent=inputValue;
    $.ajax({
        type:"GET",
        url:"/find/booksByAuthor",
        data:{inputValue:inputValue,elementId:elementId},
        success:function (data){
            count.textContent=(data.length);
            $('#bookList').empty();
            $.each(data, function(index, value) {
                $('#bookList').append(`<li class="list-item" id="${value.id+1}">
                <div class="list-item-flex">
                    <div class="list-item-image">
                        <a href="https://www.baidu.com">
                            <img src="${value.bookImage}" alt="">
                        </a>
                    </div>
                    <div class="list-item-text">
                        <div class="list-item-text-title" id="bookName">${value.bookName}</div>
                        <div class="list-item-text-name" id="bookAuthor">${value.author}</div>
                        <div class="list-item-text-desc">${value.snopsis}</div>
                        <div class="list-item-text-tag">
                            <span>${value.mainSignature}</span>
                            <span>${value.signature2}</span>
                            <span>${value.signature3}</span>
                        </div>
                    </div>
                </div>
                <div class="list-item-btn">
                    <button type="submit" id="addToBookshelf" onclick="addToBookshelf()">加入书架</button>
                </div>
            </li>`)
            })
        },
        error:function (error){
            console.log(error)
        }
    })
}
document.addEventListener('DOMContentLoaded', function() {
    // 获取所有a标签
    var tabs = document.querySelectorAll('.tab a');

    // 为每个a标签添加点击事件监听器
    tabs.forEach(function(tab) {
        tab.addEventListener('click', function(event) {

            tabs.forEach(function(t) {
                t.classList.remove('active');
            });

            tab.classList.add('active');
        });
    });
});
